<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>


<!doctype HTML>
<html>

<head>
<title>Transaction history</title>
<style>
@IMPORT url("/static/base.css");
</style>
</head>




<body>
	<%@ include file="/WEB-INF/jsp/page.header.jsp"%>
	<h1>My Transaction History</h1>

	<table class='grid'>

		<tr>
			<td>Tx ID</td>
			<td>Date</td>
			<td>Desc</td>
			<td>Total Price</td>
			<td>Payment</td>
		</tr>
		<c:forEach items='${orderList}' var='order'>

			<tr>
			<td>${order.id}</td>
				<td>${order.date}</td>
				<td><c:forEach items='${order.itemList}' var='item'>
						${fn:escapeXml(item.name)} 
						<fmt:formatNumber type="number" pattern="$###,###.00"
						value="${item.price}" />
						x 
						${item.amount} 
						<a href="/service/product/addrating?id=${item.productId}&orderId=${order.id}">Add Rating</a>
						<br/>
						</c:forEach></td>
				<td><fmt:formatNumber type="number" pattern="$###,###.00"
						value="${order.totalPrice}" /></td>
				<td>${order.status}</td>
			</tr>


		</c:forEach>
	</table>
</body>
</html>